var tableCover = {};
var user_to = [{USE_TO_COD: "01", USE_TO_NAM: "外贸自营内销"},
    {USE_TO_COD: "02", USE_TO_NAM: "特区内销"},
    {USE_TO_COD: "03", USE_TO_NAM: "其它内销"},
    {USE_TO_COD: "04", USE_TO_NAM: "企业自用"},
    {USE_TO_COD: "05", USE_TO_NAM: "加工返销"},
    {USE_TO_COD: "06", USE_TO_NAM: "借用"},
    {USE_TO_COD: "07", USE_TO_NAM: "收保证金"},
    {USE_TO_COD: "08", USE_TO_NAM: "免费提供"},
    {USE_TO_COD: "09", USE_TO_NAM: "作价提供"},
    {USE_TO_COD: "10", USE_TO_NAM: "货样,广告品"},
    {USE_TO_COD: "11", USE_TO_NAM: "其它"}];

//包装种类
var goodspackage_type = [{code: "1", name: "木箱"}, {code: "2", name: "纸箱"},
    {code: "3", name: "桶装"}, {code: "4", name: "散装"},
    {code: "5", name: "托盘"}, {code: "6", name: "包"},
    {code: "7", name: "其它"}];
var goodspackagetypeby = $.map(goodspackage_type, function (n) {
    return {
        ID: n.code,
        DM: n.code,
        MS: n.name,
        SHOWNAME: "(" + n.code + ")" + n.name
    }
});

tableCover.co_hgbzzl = goodspackagetypeby;//包装种类

//报关单类型
var declaretion_type = [{ID: 1, DM: "O", MS: "有纸报关"}, {ID: 2, DM: "M", MS: "通关无纸化"}];
var declaretiontypeby = $.map(declaretion_type, function (n) {
    return {
        ID: n.DM,
        SHOWNAME: "(" + n.DM + ")" + n.MS
    }
});
tableCover.co_bgdlx = declaretiontypeby;//报关单类型

var fee1 = [{code: "1", name: "率"}, {code: "3", name: "总价"}];

var export_port = [{code: "5189", name: "佛山新港"}, {code: "5182", name: "佛山澜石"},
    {code: "5177", name: "肇庆三榕"}, {code: "5181", name: "高明海关"},
    {code: "5138", name: "高明食出"}, {code: "5112", name: "南海九江"},
    {code: "5196", name: "云浮新港"}, {code: "5178", name: "云浮海关"},
    {code: "5304", name: "蛇口海关"}, {code: "5166", name: "南沙新港"},
    {code: "5348", name: "深关大铲"},
    {code: "5100", name: "广州海关"}, {code: "5101", name: "内港新风"},
    {code: "5103", name: "清远海关"}, {code: "5104", name: "清远英德"},
    {code: "5105", name: "广州现场"}, {code: "5106", name: "南沙小虎"},
    {code: "5107", name: "肇庆大旺"}, {code: "5108", name: "肇庆德庆"},
    {code: "5109", name: "内港滘心"}, {code: "5110", name: "南海海关"},
    {code: "5111", name: "南海官窑"}, {code: "5113", name: "南海北村"},
    {code: "5114", name: "南海平洲"}, {code: "5116", name: "南海业务"},
    {code: "5117", name: "桂江车场"}, {code: "5118", name: "平洲旅检"},
    {code: "5119", name: "南海三山"}, {code: "5120", name: "广州内港"},
    {code: "5121", name: "内港芳村"}, {code: "5122", name: "内港洲嘴"},
    {code: "5123", name: "内港四仓"}, {code: "5125", name: "从化海关"},
    {code: "5126", name: "内港赤航"}, {code: "5130", name: "广州萝岗"},
    {code: "5131", name: "花都海关"}, {code: "5132", name: "花都码头"},
    {code: "5133", name: "萝岗石牌"}, {code: "5134", name: "穗保税处"},
    {code: "5135", name: "穗现场处"}, {code: "5136", name: "穗统计处"},
    {code: "5137", name: "穗价格处"}, {code: "5139", name: "穗监管处"},
    {code: "5140", name: "穗关税处"}, {code: "5141", name: "广州机场"},
    {code: "5142", name: "民航快件"}, {code: "5143", name: "广州车站"},
    {code: "5144", name: "穗州头咀"}, {code: "5145", name: "广州邮办"},
    {code: "5146", name: "穗亚运会"}, {code: "5147", name: "穗邮办监"},
    {code: "5148", name: "穗大郎站"}, {code: "5149", name: "大铲海关"},
    {code: "5150", name: "顺德海关"}, {code: "5151", name: "顺德保税"},
    {code: "5152", name: "顺德食出"}, {code: "5153", name: "顺德车场"},
    {code: "5154", name: "北窖车场"}, {code: "5155", name: "顺德旅检"},
    {code: "5157", name: "陈村车场"}, {code: "5158", name: "顺德勒流"},
    {code: "5160", name: "番禺海关"}, {code: "5161", name: "沙湾车场"},
    {code: "5162", name: "番禺旅检"}, {code: "5163", name: "番禺货柜"},
    {code: "5164", name: "番禺船舶"}, {code: "5165", name: "南沙旅检"},
    {code: "5167", name: "南沙货港"}, {code: "5168", name: "南沙加工"},
    {code: "5169", name: "南沙海关"}, {code: "5170", name: "肇庆海关"},
    {code: "5171", name: "肇庆高要"}, {code: "5172", name: "肇庆车场"},
    {code: "5173", name: "肇庆新港"}, {code: "5174", name: "肇庆旅检"},
    {code: "5175", name: "肇庆码头"}, {code: "5176", name: "肇庆四会"},
    {code: "5179", name: "罗定海关"}, {code: "5180", name: "佛山海关"},
    {code: "5183", name: "三水码头"}, {code: "5184", name: "佛山窖口"},
    {code: "5185", name: "佛山快件"}, {code: "5186", name: "佛山保税"},
    {code: "5187", name: "佛山车场"}, {code: "5188", name: "佛山火车"},
    {code: "5190", name: "韶关海关"}, {code: "5191", name: "韶关乐昌"},
    {code: "5192", name: "三水海关"}, {code: "5193", name: "三水车场"},
    {code: "5194", name: "三水港"}, {code: "5195", name: "审单中心"},
    {code: "5197", name: "转运中心"}, {code: "5198", name: "穗河源关"},
    {code: "5199", name: "穗技术处"},

    {code: "5200", name: "黄埔关区"}, {code: "5201", name: "埔老港关"},
    {code: "5202", name: "埔新港关"}, {code: "5203", name: "新塘海关"},
    {code: "5204", name: "东莞海关"}, {code: "5205", name: "太平海关"},
    {code: "5206", name: "惠州海关"}, {code: "5207", name: "埔凤岗办"},
    {code: "5208", name: "埔开发区"}, {code: "5210", name: "埔红海办"},
    {code: "5211", name: "河源海关"}, {code: "5212", name: "新沙海关"},
    {code: "5213", name: "埔长安办"}, {code: "5214", name: "埔常平办"},
    {code: "5216", name: "埔沙田办"}, {code: "5217", name: "寮步车场"},
    {code: "5218", name: "江龙车场"}, {code: "5219", name: "埔物流园"},
    {code: "5220", name: "东莞物流"}, {code: "5221", name: "新塘车场"},

    {code: "5300", name: "深圳海关"}, {code: "5301", name: "皇岗海关"},
    {code: "5302", name: "罗湖海关"}, {code: "5303", name: "沙头角关"},
    {code: "5305", name: "深关现场"}, {code: "5306", name: "笋岗海关"},
    {code: "5307", name: "南头海关"}, {code: "5308", name: "沙湾海关"},
    {code: "5309", name: "布吉海关"}, {code: "5310", name: "淡水办"},
    {code: "5311", name: "深关车站"}, {code: "5312", name: "深监管处"},
    {code: "5313", name: "深调查局"}, {code: "5314", name: "深关邮办"},
    {code: "5315", name: "惠东海关"}, {code: "5316", name: "大鹏海关"},
    {code: "5317", name: "深关机场"}, {code: "5318", name: "梅林海关"},
    {code: "5319", name: "同乐海关"}, {code: "5320", name: "文锦渡关"},
    {code: "5321", name: "福保税关"}, {code: "5322", name: "沙保税关"},
    {code: "5323", name: "深审单处"}, {code: "5324", name: "深审价办"},
    {code: "5325", name: "深关税处"}, {code: "5326", name: "深数统处"},
    {code: "5327", name: "深法规处"}, {code: "5328", name: "深规范处"},
    {code: "5329", name: "深保税处"}, {code: "5330", name: "盐保税关"},
    {code: "5331", name: "三门岛办"}, {code: "5332", name: "深财务处"},
    {code: "5333", name: "深侦查局"}, {code: "5334", name: "深稽查处"},
    {code: "5335", name: "深技术处"}, {code: "5336", name: "深办公室"},
    {code: "5337", name: "大亚湾核"}, {code: "5338", name: "惠州港关"},
    {code: "5339", name: "深加工区"}, {code: "5340", name: "深关特办"},
    {code: "5341", name: "深惠州关"}, {code: "5342", name: "深红海办"},
    {code: "5343", name: "深盐物流"}, {code: "5344", name: "惠石化办"},
    {code: "5345", name: "深圳湾关"}, {code: "5346", name: "深机快件"},
    {code: "5349", name: "深关前海"}, {code: "5350", name: "大运通关"},
    {code: "5351", name: "前海保税"}, {code: "5352", name: "深盐综保"},

    {code: "6800", name: "江门关区"}, {code: "6810", name: "江门海关"},
    {code: "6811", name: "江门高沙"}, {code: "6812", name: "江门外海"},
    {code: "6813", name: "江门旅检"}, {code: "6816", name: "江门车场"},
    {code: "6817", name: "江门保税"}, {code: "6820", name: "新会海关"},
    {code: "6821", name: "新会港"}, {code: "6827", name: "新会稽查"},
    {code: "6830", name: "台山海关"}, {code: "6831", name: "台公益港"},
    {code: "6837", name: "台山稽查"}, {code: "6840", name: "开平海关"},
    {code: "6841", name: "开平码头"}, {code: "6847", name: "开平稽查"},
    {code: "6850", name: "恩平海关"}, {code: "6851", name: "恩平港"},
    {code: "6857", name: "恩平稽查"}, {code: "6860", name: "鹤山海关"},
    {code: "6861", name: "鹤山码头"}, {code: "6867", name: "鹤山稽查"},
    {code: "6870", name: "阳江海关"}, {code: "6871", name: "阳江港"},
    {code: "6872", name: "阳江车场"}, {code: "6877", name: "阳江稽查"}];

var work_type = [{code: "0", name: "进出闸口"}, {code: "1", name: "码头内装"}];

var confirm_type = [{code: "0", name: "是"}, {code: "1", name: "否"}];

//申报地海关
var export_port_dy = $.map(export_port, function (n) {
    return {ID: n.code, GQDM: n.code, GQJC: n.name, SHOWNAME: "(" + n.code + ")" + n.name};
});
tableCover.co_hggqdm = export_port_dy;

//币制
var goodsCurrencyMode_dys = new Array();

//征免
var exemptionof = new Array();

//运输方式
var modeoftransport = new Array();

//单证代码 co_bgsfdjlx
var codedocuments = new Array();

//成交方式 co_hgcjfs
var transactionmethod = new Array();

//目的国(地区) hg_co_gjdm
var destinationarea = new Array();

// 境内目的地
var domesticdestinatby = new Array();

//指运港 hg_co_gkdm
var PortOfDestination = new Array();

// 征免性质 co_hgzmxz
var exemptionofnature = new Array();

// 监管方式 co_hgjgfs
var regulatoryapproach = new Array();

$.ajax({
           url: "../business/hgdata-initData",
           async: false,
           success: function (data) {
               goodsCurrencyMode_dys = $.map(data.data.HGD_1, function (n) { //1.币制
                   return {
                       ID: n.code,
                       HGDM: n.code,
                       HGSM: n.name,
                       HGSX: n.type,
                       SHOWNAME: "(" + n.code + ")" + n.name
                   };
               });
               tableCover.hg_co_bz = goodsCurrencyMode_dys;

               exemptionof = $.map(data.data.HGD_5, function (n) { // 2.征免
                   return {
                       DM: n.code,
                       ID: n.code,
                       MS: n.name,
                       SHOWNAME: "(" + n.code + ")" + n.name
                   };
               });
               tableCover.co_hgzmfs = exemptionof;

               modeoftransport = $.map(data.data.HGD_A, function (n) { //3.运输方式
                   return {
                       HGDM: n.code,
                       HGSM: n.name,
                       ID: n.code,
                       SHOWNAME: "(" + n.code + ")" + n.name
                   };
               });
               tableCover.hg_co_ysgj = modeoftransport;

               codedocuments = $.map(data.data.HGD_7, function (n) { //4.单证代码
                   return {
                       DM: n.code,
                       ID: n.code,
                       SM: n.name,
                       SHOWNAME: "(" + n.code + ")" + n.name
                   };
               });
               tableCover.co_bgsfdjlx = codedocuments;

               transactionmethod = $.map(data.data.HGD_9, function (n) { //5.成交方式
                   return {
                       DM: n.code,
                       ID: n.code,
                       MS: n.name,
                       SHOWNAME: "(" + n.code + ")" + n.name
                   };
               });
               tableCover.co_hgcjfs = transactionmethod;

               destinationarea = $.map(data.data.HGD_0, function (n) { //6.目的国(地区)
                   return {
                       HGGJDM: n.code,
                       ID: n.code,
                       HGGJMC: n.name,
                       // HGYWMC:n.name, //英文名称
                       SHOWNAME: "(" + n.code + ")" + n.name
                       // +"(" + n.HGYWMC + ")"
                   };
               });
               tableCover.hg_co_gjdm = destinationarea;

               PortOfDestination = destinationarea;
               tableCover.hg_co_gkdm = PortOfDestination; //指运港(2.0指运港和目的国地区相同)

               domesticdestinatby = $.map(data.data.HGD_3, function (n) { //7.境内目的地
                   return {
                       DM: n.code,
                       ID: n.id,
                       MC: n.name,
                       SHOWNAME: "(" + n.code + ")" + n.name
                   };
               });
               tableCover.co_hgjnmdd = domesticdestinatby;

               exemptionofnature = $.map(data.data.HGD_6, function (n) { // 8.征免性质
                   return {
                       DM: n.code,
                       ID: n.code,
                       JC: n.name,
                       // QC:  备注
                       SHOWNAME: "(" + n.code + ")" + n.name
                   };
               });
               tableCover.co_hgzmxz = exemptionofnature;

               regulatoryapproach = $.map(data.data.HGD_B, function (n) { // 9.监管方式
                   return {
                       DM: n.code,
                       ID: n.id,
                       JC: n.name,
                       // QC:  备注
                       SHOWNAME: "(" + n.code + ")" + n.name
                   };
               });
               tableCover.co_hgjgfs = regulatoryapproach;

           }
       });

//集装箱规格
var containerSpecification = [{HGBM: "S", JYJYMC: "海运20尺普通"}, {HGBM: "L", JYJYMC: "海运40尺普通"}];
var containerSpecification_by = $.map(containerSpecification, function (n) {
    return {
        ID: n.HGBM,
        SHOWNAME: "(" + n.HGBM + ")" + n.JYJYMC
    }
});
tableCover.hg_co_jzx = containerSpecification_by;//集装箱规格